<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Listener
 *
 * @author miho
 */
class BluesCoders_Event_Listener {

    protected $_target;
    protected $_method;

    public function  __construct($target, $method) {
        $this->_target = $target;
        $this->_method = $method;

        if( !method_exists($target, $method) ){
            throw new Exception(sprintf('Method %s does not exists in object %s', $method, get_class($target)));
        }
    }

    public function listen(BluesCoders_Event $event) {
        return $this->_target->{$this->_method}($event);
        //return call_user_func_array(array($this->_target, $this->_method), array($event));
    }

}
?>
